package com.frame.detection.service;

import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;


@Service
public class Select_algorithm {

    private ImageDetectService imageDetectService;

    public Select_algorithm(ImageDetectService imageDetectService) {
        this.imageDetectService = imageDetectService;
    }


    //    获取原始图片
    public String fun_Original(String imageLink, MultipartFile imageFile) {

        String detectOut_h = StringUtils.isEmpty(imageFile.getOriginalFilename()) ? imageDetectService.getOriginalImageByUrl(imageLink)
                : imageDetectService.getOriginalImageByFile(imageFile);
        return detectOut_h;
    }


    //    获取去雾后的图片
//    AOD_Net
    public String fun_haze_A(String imageLink, MultipartFile imageFile) {

        String detectOut = StringUtils.isEmpty(imageFile.getOriginalFilename()) ? imageDetectService.detectByUrl_A(imageLink)
                : imageDetectService.detectByFile_A(imageFile);
        return detectOut;
    }

    //    GCANet
    public String fun_haze_G(String imageLink, MultipartFile imageFile) {

        String detectOut = StringUtils.isEmpty(imageFile.getOriginalFilename()) ? imageDetectService.detectByUrl_G(imageLink)
                : imageDetectService.detectByFile_G(imageFile);
        return detectOut;
    }

    //    FFA
    public String fun_haze_F(String imageLink, MultipartFile imageFile) {

        String detectOut = StringUtils.isEmpty(imageFile.getOriginalFilename()) ? imageDetectService.detectByUrl_F(imageLink)
                : imageDetectService.detectByFile_F(imageFile);
        return detectOut;
    }

}
